package com.wykj.business.service;

import java.sql.*;

public class TestPhoenix {
        public static void main(String args[]) {
        	System.setProperty("zookeeper.sasl.client", "false"); 
            Connection connection = null;
            Statement statement = null;
            try {
                Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
                connection = DriverManager.getConnection("jdbc:phoenix:192.168.1.222:2181", "", "");
                statement = connection.createStatement();
                ResultSet rs = statement.executeQuery("SELECT SUM(CORE) core FROM WEB_STAT");
                while (rs.next()){
                    System.out.println("Name= " + rs.getString("core"));
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    connection.close();
                    statement.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
}